Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming
Defining the constructor
A class can define a special method called its constructor, which allows you to execute behavior during the instantiation of a class. Progress allows you to define a constructor as a named block that always begins with the
CONSTRUCTORstatement and always ends with theENDCONSTRUCTORstatement. A constructor must have the same name as the name of the class in which it is defined. The constructor only executes when the class is instantiated. If the constructor isPUBLIC, its class can be instantiated directly. If it isPROTECTED, only a subclass of the class in which the constructor is defined can be instantiated directly. A constructor can also have parameters, but no defined return type. For more information on defining constructors, see the "Defining the class constructor" section.Comparison with procedure-based programming
For persistent procedures, the equivalent behavior executes directly in the main block.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |